package io.renren.modules.sell.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.sell.entity.OrderMaster;
import io.renren.modules.sell.service.OrderService;
import io.renren.modules.sys.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

/**
 * @ClassName SellerController
 * @Author mengjiafeng
 * @Date 2020/4/5 19:57
 **/
@RestController
@RequestMapping("/seller/order")
public class SellerController extends AbstractController {
    @Autowired
    OrderService orderService;
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderService.queryPage(params);

        return R.ok().put("page", page);
    }
    @GetMapping("/listByUserId")
    public R listByUserId(@RequestParam Map<String, Object> params){
        params.put("createUserId", getUserId());
        PageUtils page = orderService.queryPageByUserId(params);
        return R.ok().put("page", page);
    }


    //批量删除订单
    @PostMapping("/delete")
    public R listByUserId(@RequestBody Long[] userIds){
       orderService.deleteBatch(userIds);
        return R.ok();
    }
}
